# encoding: utf-8

import random                  # 导入随机函数random模块

class Pubcs():
    # 封装随机文字方法

    def Unicode():
        # unicode码中收录了2万多个汉字,包含很多生僻的繁体字

        val = random.randint(0x4e00, 0x9fbf)
        return chr(val)

    def GBK2312():
        # GBK2312收录了6千多常用汉字

        head = random.randint(0xb0, 0xf7)
        body = random.randint(0xa1, 0xfe)
        val = f'{head:x} {body:x}'
        str = bytes.fromhex(val).decode('gb2312')
        return str

    def Suiji():
        # 随机生成8位数字

        val = random.randint(10000000, 99999999)
        return val

    if __name__ == '__main__':
         print(Unicode())
         print(GBK2312())
         print(Suiji())
